package hot_100;

public class 打家劫舍 {
    public static void main(String[] args) {

    }

    public int rob(int[] nums) {
        int n = nums.length;
        int[] dp = new int[n + 2];
        for (int i = 1; i <= n; i++) {
            dp[i + 1] = Math.max(dp[i - 1] + nums[i - 1], dp[i]);
        }
        return dp[n + 1];
    }
}
